package com.ruoyi.project.lely.bean.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

/**
 * 分组讨论
 *
 * @author luoyong
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName(value = "`ly_groupon`", autoResultMap = true)
public class LyGroupon {


    @ApiModelProperty("ID")
    @TableId("id")
    private Long id;


    @NotNull
    @ApiModelProperty("关联的订单ID")
    @TableField(value = "`order_id`")
    private Integer orderId;


    @ApiModelProperty("参与的团购ID，仅当user_type不是1")
    @TableField(value = "`groupon_id`")
    private Integer grouponId;


    @NotNull
    @ApiModelProperty("团购规则ID，关联ly_groupon_rules表ID字段")
    @TableField(value = "`rules_id`")
    private Integer rulesId;


    @NotNull
    @ApiModelProperty("用户ID")
    @TableField(value = "`user_id`")
    private Integer userId;


    @NotNull
    @ApiModelProperty("创建者ID")
    @TableField(value = "`creator_user_id`")
    private Integer creatorUserId;


    @NotNull
    @ApiModelProperty("创建时间")
    @TableField(value = "`create_time`", fill = FieldFill.INSERT)
    private LocalDateTime createTime;


    @ApiModelProperty("更新时间")
    @TableField(value = "`update_time`", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    @Length(max = 255, message = "团购分享图片地址长度不能超过255位")
    @ApiModelProperty("团购分享图片地址")
    @TableField(value = "`share_url`")
    private String shareUrl;


    @NotNull
    @ApiModelProperty("是否已经支付")
    @TableField(value = "`payed`")
    private Integer payed;


    @ApiModelProperty("逻辑删除")
    @TableField(value = "`deleted`", fill = FieldFill.INSERT)
    private Integer deleted;

}
